\(\int \frac {\csc (x)}{i+\tan (x)} \, dx\) [5]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 11, antiderivative size = 16 \[ \int \frac {\csc (x)}{i+\tan (x)} \, dx=i \text {arctanh}(\cos (x))-i \cos (x)+\sin (x) \]

[Out]

I*arctanh(cos(x))-I*cos(x)+sin(x)

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.636, Rules used = {3599, 3187, 3186, 2717, 2672, 327, 212} \[ \int \frac {\csc (x)}{i+\tan (x)} \, dx=i \text {arctanh}(\cos (x))+\sin (x)-i \cos (x) \]

[In]

Int[Csc[x]/(I + Tan[x]),x]

[Out]

I*ArcTanh[Cos[x]] - I*Cos[x] + Sin[x]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3186

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*sin[(c_.) + (d_.)*(x_)]^(n_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_
.) + (d_.)*(x_)])^(p_.), x_Symbol] :> Int[ExpandTrig[cos[c + d*x]^m*sin[c + d*x]^n*(a*cos[c + d*x] + b*sin[c +
 d*x])^p, x], x] /; FreeQ[{a, b, c, d, m, n}, x] && IGtQ[p, 0]

Rule 3187

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*sin[(c_.) + (d_.)*(x_)]^(n_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_
.) + (d_.)*(x_)])^(p_), x_Symbol] :> Dist[a^p*b^p, Int[(Cos[c + d*x]^m*Sin[c + d*x]^n)/(b*Cos[c + d*x] + a*Sin
[c + d*x])^p, x], x] /; FreeQ[{a, b, c, d, m, n}, x] && EqQ[a^2 + b^2, 0] && ILtQ[p, 0]

Rule 3599

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[Sin[e + f*x]^
m*((a*Cos[e + f*x] + b*Sin[e + f*x])^n/Cos[e + f*x]^n), x] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] &&
 ILtQ[n, 0] && ((LtQ[m, 5] && GtQ[n, -4]) || (EqQ[m, 5] && EqQ[n, -1]))

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cot (x)}{i \cos (x)+\sin (x)} \, dx \\ & = -(i \int \cot (x) (\cos (x)+i \sin (x)) \, dx) \\ & = -(i \int (i \cos (x)+\cos (x) \cot (x)) \, dx) \\ & = -(i \int \cos (x) \cot (x) \, dx)+\int \cos (x) \, dx \\ & = \sin (x)+i \text {Subst}\left (\int \frac {x^2}{1-x^2} \, dx,x,\cos (x)\right ) \\ & = -i \cos (x)+\sin (x)+i \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (x)\right ) \\ & = i \text {arctanh}(\cos (x))-i \cos (x)+\sin (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.94 \[ \int \frac {\csc (x)}{i+\tan (x)} \, dx=-i \cos (x)+i \log \left (\cos \left (\frac {x}{2}\right )\right )-i \log \left (\sin \left (\frac {x}{2}\right )\right )+\sin (x) \]

[In]

Integrate[Csc[x]/(I + Tan[x]),x]

[Out]

(-I)*Cos[x] + I*Log[Cos[x/2]] - I*Log[Sin[x/2]] + Sin[x]

Maple [A] (verified)

Time = 1.19 (sec) , antiderivative size = 21, normalized size of antiderivative = 1.31

method result size
default \(\frac {2}{\tan \left (\frac {x}{2}\right )+i}-i \ln \left (\tan \left (\frac {x}{2}\right )\right )\) \(21\)
risch \(-i {\mathrm e}^{i x}+i \ln \left ({\mathrm e}^{i x}+1\right )-i \ln \left ({\mathrm e}^{i x}-1\right )\) \(32\)

[In]

int(csc(x)/(I+tan(x)),x,method=_RETURNVERBOSE)

[Out]

2/(tan(1/2*x)+I)-I*ln(tan(1/2*x))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 25 vs. \(2 (12) = 24\).

Time = 0.26 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.56 \[ \int \frac {\csc (x)}{i+\tan (x)} \, dx=-i \, e^{\left (i \, x\right )} + i \, \log \left (e^{\left (i \, x\right )} + 1\right ) - i \, \log \left (e^{\left (i \, x\right )} - 1\right ) \]

[In]

integrate(csc(x)/(I+tan(x)),x, algorithm="fricas")

[Out]

-I*e^(I*x) + I*log(e^(I*x) + 1) - I*log(e^(I*x) - 1)

Sympy [F]

\[ \int \frac {\csc (x)}{i+\tan (x)} \, dx=\int \frac {\csc {\left (x \right )}}{\tan {\left (x \right )} + i}\, dx \]

[In]

integrate(csc(x)/(I+tan(x)),x)

[Out]

Integral(csc(x)/(tan(x) + I), x)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 28 vs. \(2 (12) = 24\).

Time = 0.21 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.75 \[ \int \frac {\csc (x)}{i+\tan (x)} \, dx=\frac {2}{\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + i} - i \, \log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right ) \]

[In]

integrate(csc(x)/(I+tan(x)),x, algorithm="maxima")

[Out]

2/(sin(x)/(cos(x) + 1) + I) - I*log(sin(x)/(cos(x) + 1))

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.25 \[ \int \frac {\csc (x)}{i+\tan (x)} \, dx=-\frac {2 i}{-i \, \tan \left (\frac {1}{2} \, x\right ) + 1} - i \, \log \left (\tan \left (\frac {1}{2} \, x\right )\right ) \]

[In]

integrate(csc(x)/(I+tan(x)),x, algorithm="giac")

[Out]

-2*I/(-I*tan(1/2*x) + 1) - I*log(tan(1/2*x))

Mupad [B] (verification not implemented)

Time = 4.25 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.25 \[ \int \frac {\csc (x)}{i+\tan (x)} \, dx=-\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )\,1{}\mathrm {i}+\frac {2}{\mathrm {tan}\left (\frac {x}{2}\right )+1{}\mathrm {i}} \]

[In]

int(1/(sin(x)*(tan(x) + 1i)),x)

[Out]

2/(tan(x/2) + 1i) - log(tan(x/2))*1i